package org.windey.server.web;


public class AdminSidebar {
	
	private Boolean loggedin;
	
	public AdminSidebar(Boolean loggedin) {
		if (loggedin == null) {
			this.loggedin = false;
		}
		else {
			this.loggedin = loggedin;
		}
		
	}
	
	public String generate() {
		String s = "<div id=\"sidebar\">" + 
					"<div id=\"sidebar-bgtop\">" + 
					"<div id=\"sidebar-bgbtm\">" +
					"<ul>" + 
					"<li>";
		if (!loggedin) {
			s += "<h2>Log In</h2>" + 
					"<div id=\"search\">" + 
					"<form action=\"processlogin.jsp\" method=\"post\">" + 
					"<table>" + 
					"<tr>" + 
					"<td><input name=\"admin\" type=\"text\" /></td>" + 
					"</tr>" + 
					"<tr>" + 
					"<td><input name=\"pass\" type=\"password\" /></td>" + 
					"</tr>" + 
					"<tr>" + 
					"<td><input name=\"login\" type=\"submit\" value=\"Log In\" /></td>" + 
					"</tr>" + 
					"</table>" + 
					"</form>" + 
					"</div>";
		}
		else if (loggedin){
			s += "<h2><a href=\"logout.jsp\">Log Out</a></h2>" + 
					"<div id=\"search\">" + 
					"<p><em>Logged in as Admin</em></p>" + 
					"</div>";
		}
		s += "<div style=\"clear: both;\">&nbsp;</div>" + 
				"</li>" + 
				"</ul>" + 
				"</div>" + 
				"</div>" + 
				"</div>";
		return s;
	}


}
